<include file="Public/head"/>
</head>
<body>
<include file="Public/common_header"/>

<div class="mian">
    <include file="Public/sidebar" menu='zhgl.ygzh'/>
    <div class="mianR">

        <div class="listBox">
            <form id="fm" action="/Emp/index" method="GET">
                <div class="yuList">

                    <div class="xinzeng clearfix">
                        <a href="/Emp/group_add"><input type="button" onclick="create_emp();" value="新增分组"/></a>
                    </div>
                    <div class="yuListCo">
                        <h4 class="clearfix"><em class="listW1">ID</em>
                            <em class="listW4">组名称</em>
                            <em class="listW5">描述</em>
                            <em class="listW7">状态</em>
                            <em class="listW8-2">操作</em>
                        </h4>
                        <ul>
                            <?php foreach ($glist as $key =>$group): ?>
                            <li class="listBg clearfix">
                                <em class="listW1">{$group.id}</em>
                                <em class="listW4">{$group.title}</em>
                                <em class="listW5">{$group.remark}</em>
                                <em class="listW7">{$group['status']?'禁用':'启用'}</em>
                                <em class="listW8-2">
                                    <a href="/Emp/group_add/group_id/{$group.id}">编辑</a>
                                    <if condition="($group.status eq 1)">
                                        <a href="" onclick="return ci_op('{$group.id}',0);">启用</a>
                                        <else/>
                                        <a href="" onclick="return ci_op('{$group.id}',1);">禁用</a>
                                    </if>
                                    <a href="" onclick="return ci_op('{$group.id}',-1);">删除</a>
                                </em>
                            </li>
                            <?php endforeach ?>

                        </ul>
                    </div>


                </div>
            </form>

        </div>
    </div>
    <div class="clear"></div>
</div>


<script>
    function ci_op(group_id, op_type) {
        var post_data = {group_id: group_id, op_type: op_type};
        $.post('/Emp/ci_group_op', post_data, function (res) {
            if (res.code == 200) {
                delay_alert('操作成功!');
                setTimeout(function () {
                    window.location.reload();
                }, 300);
            } else {
                delay_alert(res.msg);
            }
        }, 'json');
        return false;
    }
    ;


</script>

<include file="Public/foot"/>